import * as axios from 'axios'

const baseURL = 'http://www.ilove03.com/api'

const instance = axios.create({
  baseURL,
  timeout: 5000
})

function request ({method = 'post', url, data, headers}) {
  var options = { method, url, data }
  if (headers) {
    options[headers] = headers
  }
  return instance(options).then(res => res.data)
}
export default request
